$(function(){
    $(".goback").on('click',function () {
        window.location = '/order/index';
    });

    lay('#version').html('-v'+ laydate.v);
    laydate.render({
        elem: '#start_time'
    });
    laydate.render({
        elem: '#end_time'
    });

//展示SKU
    $('.getsku').on('click',function(){
        // var googsid = $(this).attr('googsid');
        var goods_attr_id = $(this).attr('goods_attr_id');

        ajax("post","/order/get-googsattr",{attr_id:goods_attr_id},
            function success(data){
                var dIv="<div class='b-div'><h4 class='b-h4'>SKU</h4><div class='b-btn'>";
                dIv += "<table class=' table  table-striped table-bordered table-advance table-hover'>";
                dIv += '<tr>';
                dIv += '<th>属性</th>';
                dIv += '<th>原价</th>';
                dIv += '<th>折后价</th>';
                dIv += '<th>库存</th>';
                dIv += '</tr>';
                $(data.data).each(function ($key,$val) {
                    dIv += '<tr>';
                    dIv += '<td>'+$val.attr_value+'</td>';
                    dIv += '<td>'+$val.original_price+'</td>';
                    dIv += '<td>'+$val.discount_price+'</td>';
                    dIv += '<td>'+$val.inventory+'</td>';
                    dIv += '</tr>'
                })
                dIv+='</table>'
                dIv += "<input type='button' onclick='closeattr()' value='取消' class='b-cancel'></div></div>";
                $("body").append(dIv);
            }
        );

    });
});
function closeattr() {
    $('.b-div').hide();
}